#!/bin/bash
# author: mmatczuk

function printinfo {
  echo ;echo --- USE: $(basename "${0}") \{mapeditor \| deerhunter\} [clean, online]
}

cd "$(dirname ${0})"
curdir=$(pwd)

action=""
offline="-o"

case ${1} in
  "mapeditor") ;;
  "deerhunter");;
  *) printinfo; exit -1
esac

case ${2} in
  "clean") action="clean";;
  "online") offline="";;
  "");;
  *) printinfo; exit -2
esac

case ${3} in
  "clean") action="clean";;
  "online") offline="";;
  "");;
  *) printinfo; exit -3
esac

cd ${curdir}/CODE && mvn ${action} package ${offline} -Dmaven.test.skip=true && cd mas-${1}/target && java -jar mas-${1}-*.jar || printinfo
